//
//  MDHRACExtension.h
//  MDHPT
//
//  Created by 高得华 on 2019/4/23.
//  Copyright © 2019年 高得华. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ReactiveObjC.h"
#if __has_include(<AFNetworking/AFNetworking.h>)
#import <AFNetworking/AFNetworking.h>
#else
#import "AFNetworking.h"
#endif

///APPStore中APP的ID
static NSInteger const kVersionUpdateAppid = 1449335949;

//MARK: - === 请求Method 方式
///GET 请求
static NSString * const MMWPT_HTTTP_METHOD_GET    = @"GET";
///HEAD
static NSString * const MMWPT_HTTTP_METHOD_HEAD   = @"HEAD";
///POST
static NSString * const MMWPT_HTTTP_METHOD_POST   = @"POST";
///PUT
static NSString * const MMWPT_HTTTP_METHOD_PUT    = @"PUT";
///PATCH
static NSString * const MMWPT_HTTTP_METHOD_PATCH  = @"PATCH";
///DELETE
static NSString * const MMWPT_HTTTP_METHOD_DELETE = @"DELETE";

///
static NSString * const RACAFNResponseObjectErrorKey = @"responseObject";

NS_ASSUME_NONNULL_BEGIN

@interface MDHRACExtension : NSObject

@end

NS_ASSUME_NONNULL_END



//MARK: - ==== MDHHTTPServiceAdditions
///从MDHHTTPServiceAdditions检索分析结果的便利类别。
@interface RACSignal (MDHHTTPServiceAdditions)

// This method assumes that the receiver is a signal of MHHTTPResponses.
//
// Returns a signal that maps the receiver to become a signal of
// MHHTTPResponses.parsedResult.
- (RACSignal *)mdh_parsedResults;

@end


//MARK: - ===== AFHTTPSessionManager
@interface AFHTTPSessionManager (RACSupport)

/// A convenience around -GET:parameters:success:failure: that returns a cold signal of the
/// resulting JSON object and response headers or error.
- (RACSignal *)rac_GET:(NSString *)path parameters:(id)parameters;

/// A convenience around -HEAD:parameters:success:failure: that returns a cold signal of the
/// resulting JSON object and response headers or error.
- (RACSignal *)rac_HEAD:(NSString *)path parameters:(id)parameters;

/// A convenience around -POST:parameters:success:failure: that returns a cold signal of the
/// result.
- (RACSignal *)rac_POST:(NSString *)path parameters:(id)parameters;

/// A convenience around -POST:parameters:constructingBodyWithBlock:success:failure: that returns a
/// cold signal of the resulting JSON object and response headers or error.
- (RACSignal *)rac_POST:(NSString *)path parameters:(id)parameters constructingBodyWithBlock:(void (^)(id <AFMultipartFormData> formData))block;

/// A convenience around -PUT:parameters:success:failure: that returns a cold signal of the
/// resulting JSON object and response headers or error.
- (RACSignal *)rac_PUT:(NSString *)path parameters:(id)parameters;

/// A convenience around -PATCH:parameters:success:failure: that returns a cold signal of the
/// resulting JSON object and response headers or error.
- (RACSignal *)rac_PATCH:(NSString *)path parameters:(id)parameters;

/// A convenience around -DELETE:parameters:success:failure: that returns a cold signal of the
/// resulting JSON object and response headers or error.
- (RACSignal *)rac_DELETE:(NSString *)path parameters:(id)parameters;

@end

